package com.sunshine.lnuplus.view.Welcome;

import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProviders;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.sunshine.lnuplus.R;
import com.sunshine.lnuplus.databinding.FragmentToLoginBinding;
import com.sunshine.lnuplus.utils.TagHelper;
import com.sunshine.lnuplus.view.Login.LoginActivity;
import com.sunshine.lnuplus.view.Main.MainActivity;

public class toLoginFragment extends Fragment implements View.OnClickListener {

    private FragmentToLoginBinding binding;

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
        binding = DataBindingUtil.inflate(inflater,R.layout.fragment_to_login,container,false);
        return binding.getRoot();
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        binding.buttonToLogin.setOnClickListener(this);
        binding.buttonNo.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.button_toLogin:
                startActivity(new Intent(getContext(),LoginActivity.class).putExtra("first_start",true));
                getActivity().finish();
                break;
            case R.id.button_no:
                startActivity(new Intent(getContext(), MainActivity.class));
                getActivity().finish();
                break;
        }
    }
}
